home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / obsolete / latlon.pro < prev    next >
Text File  |  1997-07-08  |  3KB  |  98 lines

  1. ; $Id: latlon.pro,v 1.2 1997/01/15 04:02:19 ali Exp $
  2. ;
  3. ; Copyright (c) 1990-1997, Research Systems, Inc.  All rights reserved.
  4. ;       Unauthorized reproduction prohibited.
  5.  
  6. pro LatLon
  7. ;+
  8. ; NAME:
  9. ;    LATLON
  10. ;
  11. ; PURPOSE:
  12. ;    If the current window has map coordinates (i.e., MAP_SET has been used
  13. ;    to set up a map projection), LATLON tracks the longitude and latitude 
  14. ;    of the mouse location and displays them in a separate window. 
  15. ;
  16. ;    To activate tracking, click on the left mouse button while the cursor 
  17. ;    is in the plotting window. To stop, position the cursor in the 
  18. ;    plotting  window and press the right button.
  19. ;
  20. ; CATEGORY:
  21. ;    Mapping.
  22. ;
  23. ; CALLING SEQUENCE:
  24. ;    LATLON 
  25. ;
  26. ; INPUTS:
  27. ;    None.
  28. ;
  29. ; KEYWORD PARAMETERS:
  30. ;    None.
  31. ;
  32. ; OUTPUTS:
  33. ;    Latitude and longitude values are printed in a new window.
  34. ;
  35. ; COMMON BLOCKS:
  36. ;    None.
  37. ;
  38. ; SIDE EFFECTS:
  39. ;    A new window is created.
  40. ;
  41. ; RESTRICTIONS:
  42. ;    The window must have map coordinates.
  43. ;
  44. ; EXAMPLE:
  45. ;    Set up a Mercator map projection by entering the following command:
  46. ;        MAP_SET, /MERCATOR, /GRID, /CONTINENT
  47. ;
  48. ;    Invoke LATLON by entering:
  49. ;        LATLON
  50. ;
  51. ;    A new window labeled "Latitude/Longitude" should appear.  Put the mouse
  52. ;    cursor in the map window and press the left mouse button to begin
  53. ;    tracking the position of the cursor.  Press the right mouse button 
  54. ;    over the map to end LATLON.
  55. ;
  56. ; MODIFICATION HISTORY:
  57. ;    Written by Ann Bateson, June 1990
  58. ;
  59. ;-
  60.  
  61. if (!x.type NE 2) THEN GOTO,DONE   ;Need Mapping Coordinates
  62.  
  63. Save=!D.Window
  64. supports_windows = (!d.flags and 256) ne 0
  65. if (supports_windows) then  $  ;Display window for latlon
  66.  Window,1,Title="Latitude/Longitude",XSIZE=300,YSIZE=25
  67.  
  68. S2=!D.Window
  69. if (supports_windows) then WSET,Save
  70. cursor,x,y,/Normal
  71. x2=x & y2=y
  72.  
  73. while ( !ERR NE 4) DO BEGIN   ; Read cursor from plotting window and 
  74.                               ; print latitude and longitude in
  75.                               ; plotting window or latlon display window 
  76. cursor,x1,y1,/nowait
  77. if(ABS(X1-X2) GE.01) or (ABS(Y1-Y2) GE .01) THEN BEGIN
  78.  if (supports_windows) then WSet,S2
  79. ; erase
  80.  xyouts,50,10,   $
  81.        string(Format='(f9.4)',y2)+' /'+string(Format='(f9.4)',x2),/Device,col=0
  82.  xyouts,50,10,   $
  83.        string(Format='(f9.4)',y1)+' /'+string(Format='(f9.4)',x1),/Device
  84.  if (supports_windows) then WSet,Save 
  85.                  ;switch back to plot window to read coordinates
  86.  
  87.  X2=X1 & Y2=Y1
  88. ENDIF
  89. ENDWHILE
  90.  
  91. if (supports_windows) then WDelete,S2
  92. Return
  93. DONE  : print,"latlon- Current window must have map coordinates"
  94. RETURN
  95. END
  96.  
  97.  
  98.